/**
 * Created by FASHVN-001 on 2018/6/11.
 */
/*
let a=1;
console.log(a);
*/
//var b = 'judy';
/*window.onload = function () {
    console.log(b); //全局的变量
};*/

/*
{
    let b = 'zhuyanmeng'
}
console.log(b); //judy*/

/*for (let i =0;i<10;i++){
    console.log(i)
}*/

/*
* 常量声明
* */
//const a = 'judy';
//const a = 'dd'

/*
* 数据解构
* */
/*
let [c,d,e] = [1,2,3];
console.log(c)
console.log(d)
console.log(e)*/

/*const [a,b,c,d,e,f]="JSPang";
console.log(a);
console.log(b);
console.log(c);
console.log(d);
console.log(e);
console.log(f);*/
/*let [a,b='judy'] = ['祝言',undefined] ;
console.log(a+b) ;*/

/*
//对象扩展运算符
function judy(...arg){
    console.log(arg[0]);
    console.log(arg[1]);
    console.log(arg[2]);
    console.log(arg[3]);
}
judy(1,2,3) ;//1 2 3 undefined
judy(0,1,2,3) ;//0 1 2 3
*/

/*
let arr1 = ['a','b','c'];
let arr2 = arr1;
console.log(arr2);
arr2.push('d');
console.log(arr1);//["a", "b", "c", "d"]
*/

/*
//rest运算符
function judy(first,...arg){
    console.log(arg.length);
    console.log(arg)
}
judy(0,1,2,3,4,5,6,7);//[1, 2, 3, 4, 5, 6, 7]
*/

/*
//循环输出参数的值(不包括第一个)
function jspang(first,...arg){
    for(let val of arg){
        console.log(val);
    }
}
jspang(1,3,5,7,9,2,4);//3 5 7 9 2 4
*/

/*
//字符串模板
let judy = 'zhuyanmeng';
let miaoshu = `很高兴与您相遇${judy}.谢谢！`; //注意：这个必须是两届好（键盘tab键上面的那个）
document.write(miaoshu );
*/

/*
let jspang='技术胖';
let blog = `非常高兴你能看到这篇文章，我是你的老朋友${jspang}。这节课我们学习字符串模版。`;
document.write(blog);
*/

/*
//对运算的支持
let a = 1;
let b = 2;
let result=`${a+b}`; //这个引号特别注意：Tab键上面的引号
document.write('计算结果为'+result);
*/

/*
//查找是否存在
let judy = 'zhuyanmeng';
let miaoshu = `很高兴与您相遇${judy}.谢谢！`; //注意：这个必须是两届好（键盘tab键上面的那个）
document.write(miaoshu.includes(judy) ); //true
//判断开头是否存在
document.write(miaoshu.startsWith(judy) );//false
//判断结尾是否存在
document.write(miaoshu.endsWith(judy) );//false
*/

/*
//数字验证
let a =2;
console.log(Number.isFinite(a)); //true
console.log(Number.isFinite('judy')); //false
console.log(Number.isFinite('NaN'));//false
console.log(Number.isFinite('undefined'));//false
*/

/*
//复制字符串/或数组
//我们有时候是需要字符串重复的，比如分隔符和特殊符号，这时候复制字符串就派上用场了，语法很简单。
//repeat(number) repeat可以复制数组也可以复制参数  number复制几次
document.write('jspang|'.repeat(3)); //jspang|jspang|jspang|
document.write('[1,2,3,4]'.repeat(3)); //[1,2,3,4][1,2,3,4][1,2,3,4]
*/

//NaN验证
//NaN是特殊的非数字，可以使用Number.isNaN()来进行验证。
//console.log(Number.isNaN(8)); //false

/*
//判断是否为整数
let a = 2.33;
console.log(Number.isNaN(a));
*/

/*
//整数转换Number.parseInt(XXX)
//浮点数转换Number.parseFloat(xxx)
let b = 9.13;
console.log(Number.parseInt(b)); //9
console.log(Number.parseFloat(b));//9.13

console.log(Number.MAX_SAFE_INTEGER); //90007199254740991
*/

/*let json = {
    '0':'judy',
    '1':'祝',
    '2':'你好啊',
    length:3
};
let arr = Array.from(json);
console.log(arr);*/

let judy = 'Judynihao';
let blog= `hah${judy}ahha6666`;
console.log(blog);

/*let a=1;
let b=2;
let result=`${a+b}`;
document.write(result);*/

/*//字符串查找
let js = 'judy';
let cc = 'sssssssssssjudy';
document.write(cc.includes(js)); //true
console.log(cc.startsWith(js)); //false*/

/*//json格式转换
let  json = {
    '0': 'jspang',
    '1': '技术胖',
    '2': '大胖逼逼叨',
    length:3
};

let arr=Array.from(json);
console.log(arr);


let arr2 =Array.of(3,4,5,6);
console.log(arr2);*/

/*let arr=[1,2,3,4,5,6,7,8,9];
console.log(arr.find(function(value,index,arr){
    return value > 5;  // 6
    //return index >3 //5
    //return arr //1
}))*/
/*
* fill()也是一个实例方法，它的作用是把数组进行填充，它接收三个参数，第一个参数是填充的变量，第二个是开始填充的位置，第三个是填充到的位置。
* */
/*let arr=[0,1,2,3,4,5,6,7,8,9];
arr.fill('jspang',2,5); //含头不含为 复制
console.log(arr);*/

//for...of 循环遍历
/*let arr = ['judy','nihao','xiaorong']
for(let item of arr){
    console.log(item); //judy nihao xiaorong
}*/

/*
//for…of数组索引
let arr = ['judy','nihao','xiaorong'];
for(let index of arr.keys()){
    console.log(index) //0 1 2
}
*/

/*//同时输出数组的数值和索引
let arr = ['judy','nihao','xiaorong'];
for (let [index,val] of arr.entries()){
    console.log(index +''+val);
    console.log(typeof (val)) //string
}*/

//entries()
let arr = ['judy','nihao','xiaorong'];
let list = arr.entries();
console.log(list);//Array Iterator {}
console.log(list.next().value);//[0, "judy"]
console.log(list.next().value);//[1, "nihao"]
console.log(list.next().value);//[2, "xiaorong"]
